#!/bin/bash
#------------------------------------------------------------------------------
#Filename:	74716-directory.sh
#Version:	1.1
#Date:		2013/07/11
#Author:	yuanhui.shi
#Email:		yuanhui.shi@cs2c.com.cn
#Summary:	02.01系统核心功能-01文件系统-03文件分类-01验证系统可识别目录类型文件
#Notes:	 	验证系统识别的目录类型
#Copyright:	China Standard Software Co.,Ltd.
#History:
#		Version 1.0,2013/07/11
#		-The first one
#		Version 1.1,2013/09/03
#		-Modify the script to satisfy the shell standard
#		Version 1.2,2013/09/04
#       	-when executed,calling public function replace lots of codes.
#------------------------------------------------------------------------------


PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH

source ../../lib/Echo.sh
source ./lib/Ssh.sh
source ../../lib/XmlParse.sh

function CleanData ()
{
 rm -rf /home/${USER}/directory
 userdel -r ${USER}
 EchoInfo "74716-directory执行完毕"
}

trap "CleanData" EXIT

DATA_DIR="./data"
DATA_FILE="74716-directory.xml"


XmlParse ${DATA_DIR}/${DATA_FILE}

GetValue USER USER
GetValue PASSWORD PASSWORD
GetValue IP IP


id -ru ${USER} && userdel -r ${USER}
Adduser ${USER} ${PASSWORD}

Ssh ${USER} ${IP} ${PASSWORD} "mkdir directory"
 
[ -d  /home/${USER}/directory ]
EchoResult "新建目录directory成功" 

